// .txt

beginzonescript;

variables;

short crime_tolerance = 5;
short last_abil;
short i;
short walk_timer = 0;

body;

beginstate INIT_STATE;
	sf(8,3,0);
	
	if ((has_spec_item(41) > 0) || (has_spec_item(42) > 0) || (has_spec_item(43) > 0) || (has_spec_item(44) > 0) || (has_spec_item(45) > 0))
		sf(8,7,1);
		
	set_name(10,"Repository Guardian");
	set_new_abil(10,12);
	set_boss_level(10,1);
	
	add_range_to_group(11,15,1);

	if (get_sdf(8,4) > 0) {
		make_zone_hostile();
		}

	last_abil = get_current_tick();
	
	set_crime_tolerance(crime_tolerance);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	// clear zone?
	if ((zone_clear(ME) == FALSE) && (get_flag(8,5) > 0)) {
		print_str_color("You have managed to break into the Repository.",2);
		award_party_xp(200,20);
		clear_zone(ME);	
		}
		
	if ((get_crime_level() >= crime_tolerance) && (get_sdf(8,4) == 0)) {
		make_zone_hostile();
		set_flag(8,4,1);
		}

	//if (get_ran(1,0,100) < 10)
	//	give_char_text_bubble(,"");

	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 3))) {
		last_abil = get_current_tick();

		walk_timer = walk_timer + 1;
		if (walk_timer >= 4) {
			walk_timer = 0;
			if (gf(8,2) == 0)
				sf(8,2,1);
				else sf(8,2,0);
			}
		
		if (gf(8,26) > 0)
			inc_flag(8,26,-1);
		}
break;

beginstate 10;
	set_terrain_string_range("The sign says - Vault Access.",3);
break;

//	print_str("");
//	set_terrain_string_range(".",3);
//	set_terrain_string_range("The sign says - .",3);
